import axios from "axios";
export default function (callback, relGroup) {
    // let url = "http://test.mall.yn.weilian.cn/resourceLevel/resourceLevelList";
    let url = window.api.config_host+window.api.config_ad;
    // let params = {relPosition : "HomePageBanner"}
    let options = {
        method: "get",
        url,
        params: {storeCode: localStorage.getItem("storeCode"),relGroup:relGroup},
        headers: {sessionId: getCookie("sessionId")}
    }
    axios(options).then(data => {
        console.log("data", data);
        if (data.status === 200 && data.data.returnCode === 1) {
            if (data.data.data) {
                callback && callback(data.data.data);
            } else {
                console.log("接口请求成功，但没有数据！");
            }
            //发布事件
            // console.log("PSEvent", PSEvent);
            PSEvent.trigger("bannerUpdate");
        } else {
            console.log("请求接口失败");
        }
        
    }).catch(err => {
        console.log(err);
    });
}